import {
  checkLogin
} from './auth.js'
new Vue({
  el: '#app',
  data: {
    IS_LOGIN: null,
    menuList: []
  },
  async created() {
    this.IS_LOGIN = await checkLogin()
    if (this.IS_LOGIN == null) {
      location.href = '/'
    }
    this.getMenuList()
  },
  methods: {
    async getMenuList() {
      const res = await request.get('/menu/getMenuByManager')
      this.menuList = res.data
      console.log(this.menuList);
    },
    async logout() {
      const res = await request.post('/manage/logout')
      if (res.code == 200) {
        localStorage.removeItem("authtoken")
        location.href = '/'
      }
    }
  }
});